<!-- 品牌详情页 -->
<template>
  <div class="brandDetail-main">
    <Navbar :title="title" />
    <div class="brandTop">
      <img class="brandImg" :src="detailAction.list_pic_url" alt />
      <div class="brandTopTitle">
        <span>{{detailAction.name}}</span>
      </div>
    </div>
    <div class="brandTopdes">{{detailAction.simple_desc}}</div>
    <div class="brandProduct" v-if="detailGoodsList.length!=0">
      <div class="brandProductItem" v-for="item in detailGoodsList" :key="item.id">
        <img class="brandProductImg" :src="item.list_pic_url" alt />
        <div class="brandProductDes">
          <div class="brandProductName">{{item.name}}</div>
          <div class="brandProductPrice">¥ {{item.retail_price}}</div>
        </div>
      </div>
    </div>
    <div v-else class="none">
        数据库暂无数据...
    </div>
  </div>
</template>

<script>
import Navbar from "@/components/Navbar";
import brandApi from "@/api/brand/index";
export default {
  name: "brandDetail",
  components: {
    Navbar,
  },
  data() {
    return {
      title: "品牌制造商",
      id: "",
      detailAction: [],
      detailGoodsList: [],
    };
  },
  created() {
    this.id = this.$route.params.id;
    this.getbrandDetail();
  },
  methods: {
   async getbrandDetail() {
     await brandApi.detailAction({
          id: this.id,
        })
        .then((res) => {
          this.detailAction = res.data;
          this.detailGoodsList = res.goodsList;
        });
    },
  },
};
</script>
<style lang='scss' scoped>
.brandDetail-main {
  .brandTop {
    position: relative;

    .brandImg {
      width: 100%;
      height: 145px;
    }
    .brandTopTitle {
      position: absolute;
      top: 50%;
      left: 0;
      margin-top: -15px;
      width: 100%;
      text-align: center;
      span {
        padding-bottom: 8px;
        color: $bagColor;
        display: inline-block;
        font-size: 19px;
        height: 20px;
        border-bottom: 3px solid $bagColor;
      }
    }
  }
  .brandTopdes {
    height: 60px;
    background-color: $bagColor;
    text-align: center;
    font-size: 15px;
    color: #666;
    padding: 21px 16px;
  }
  .brandProduct {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 7px;
    .brandProductItem {
      width: 186px;
      height: 240px;
      background-color: $bagColor;
      margin-bottom: 3px;
      .brandProductImg {
        width: 151px;
        height: 151px;
        margin-left: 17.5px;
      }
      .brandProductDes{
          text-align: center;
          color: #000;
          .brandProductPrice{
              font-size: 15px;
              padding-top: 15px;
              color: $baseColor;
          }
      }
    }
  }
  .none{
      font-size: 16px;
      color: #999;
      line-height: 100px;
      margin-top: 50px;
      text-align: center;
  }
}
</style>